package com.hudson.plugin;

import javax.persistence.*;
import java.util.HashSet;
import java.util.Set;

import static javax.persistence.GenerationType.IDENTITY;

/**
 * Hudsons entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "hudsons", catalog = "reportdb")
public class Hudsons implements java.io.Serializable {

    // Fields

    private Integer id;
    private String url;
    private String description;
    private String slaves;
    private Set<Views> viewses = new HashSet<Views>(0);
    private Set<Projects> projectses = new HashSet<Projects>(0);

    // Constructors

    /**
     * default constructor
     */
    public Hudsons() {
    }

    /**
     * full constructor
     */
    public Hudsons(String url, String description, String slaves,
                   Set<Views> viewses, Set<Projects> projectses) {
        this.url = url;
        this.description = description;
        this.slaves = slaves;
        this.viewses = viewses;
        this.projectses = projectses;
    }

    // Property accessors
    @Id
    @GeneratedValue(strategy = IDENTITY)
    @Column(name = "id", unique = true, nullable = false)
    public Integer getId() {
        return this.id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    @Column(name = "url", length = 256)
    public String getUrl() {
        return this.url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    @Column(name = "description", length = 1024)
    public String getDescription() {
        return this.description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    @Column(name = "slaves", length = 512)
    public String getSlaves() {
        return this.slaves;
    }

    public void setSlaves(String slaves) {
        this.slaves = slaves;
    }

    @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "hudsons")
    public Set<Views> getViewses() {
        return this.viewses;
    }

    public void setViewses(Set<Views> viewses) {
        this.viewses = viewses;
    }

    @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "hudsons")
    public Set<Projects> getProjectses() {
        return this.projectses;
    }

    public void setProjectses(Set<Projects> projectses) {
        this.projectses = projectses;
    }

}